package com.armed.client.interfaz.ventas;

import com.armed.ejb.transference.Medico;
import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import init.org.util.Constants;

/**
 * Class ListMedicosRenderer
 *
 *
 * @author init() software
 * @version 23/01/2008 
 */
public class ListMedicosRenderer extends DefaultListCellRenderer
{
    @Override
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
    {
        Component component = super.getListCellRendererComponent(list, value,index,isSelected,cellHasFocus);
        if (value != null && value instanceof Medico) 
        {
            Medico med = (Medico) value;
            
            ((JLabel) component).setText(med.getLinea());
            ((JLabel) component).setHorizontalAlignment(JLabel.LEFT);
            ((JLabel) component).setIcon(new ImageIcon(getClass().getResource(Constants.DOCTOR_ICON)));
            return component;
        }
        return null;
    }
}
